//
//  XBLoading.m
//  lxtxAppCustomer
//
//  Created by com.chetuba on 15/11/4.
//  Copyright © 2015年 LXTX. All rights reserved.
//

#import "XBLoading.h"

@interface XBLoading()


/**
 *  正在加载
 */
@property (weak, nonatomic) IBOutlet UIView *YESACtivity;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activity;
//@property (weak, nonatomic) IBOutlet MONActivityIndicatorView *activity;
@property (weak, nonatomic) IBOutlet UILabel *textActivity;

/**
 *  无信息
 */
@property (weak, nonatomic) IBOutlet UIView *NOInformation;
@property (weak, nonatomic) IBOutlet UILabel *textInformation;
@property (weak, nonatomic) IBOutlet UIImageView *imageInformation;
/**
 *  无网络
 */
@property (weak, nonatomic) IBOutlet UIView *NONetwork;
@property (weak, nonatomic) IBOutlet UILabel *textNetwork;
@property (weak, nonatomic) IBOutlet UIImageView *imageNetwork;

@end

@implementation XBLoading


-(void)awakeFromNib{
    [super awakeFromNib];
    
    
//    self.activity.numberOfCircles = 6;
//    self.activity.radius = 10;
//    self.activity.internalSpacing = 5;
//    self.activity.delegate = self;
    [self.activity startAnimating];
    self.YESACtivity.hidden = YES;
    self.NOInformation.hidden = YES;
    self.NONetwork.hidden = YES;
    
    
    
}

-(void)setupException:(Loading_TYPE)exceptionType{
    
    self.isHandleException = NO;
    
    switch (exceptionType) {
          
            
        case Loading_TYPE_YES:
            
            
            /// 多余的  可以不用管  因为在外面就直接 隐藏了view了
            self.isHandleException = YES;
            self.YESACtivity.hidden = YES;
            self.NOInformation.hidden = YES;
            self.NONetwork.hidden = YES;
            [self.activity stopAnimating];
            
            break;
            
        case Loading_TYPE_DATA:
            
            self.isHandleException = YES;
            
            self.YESACtivity.hidden = NO;
            self.NOInformation.hidden = YES;
            self.NONetwork.hidden = YES;
            [self.activity startAnimating];
            
            break;
        case Loading_TYPE_NO_DATA:
            
            self.isHandleException = YES;
            
            self.YESACtivity.hidden = YES;
            self.NOInformation.hidden = NO;
            self.NONetwork.hidden = YES;
            [self.activity stopAnimating];
            
            break;
            
        case Loading_TYPE_NO_NETWORK:
            
            self.isHandleException = NO;
            
            self.YESACtivity.hidden = YES;
            self.NOInformation.hidden = YES;
            self.NONetwork.hidden = NO;
            [self.activity stopAnimating];
            
            break;
            
        default:
            break;
    }
    
    
    
    
}
/**
 *  设置 信息 提示语
 *
 *  @param text 文字
 */
- (void)settextInformation:(NSString *)text{
    
    
    self.textInformation.text = text;
    
}
/**
 *  设置 加载 提示语
 *
 *  @param text 文字
 */
- (void)settextActivity:(NSString *)text{
    
    
    self.textActivity.text = text;
    
}

/**
 *  设置 信息 提示 图
 *
 *  @param image 图片
 */
- (void)setimageInformation:(UIImage *)image{
    
    self.imageInformation.image = image;
    
}

/**
 *  设置无网络  提示 语
 *
 *  @param text 文字
 */
- (void)settextNetwork:(NSString *)text{
    
    self.textNetwork.text = text;
    
}
/**
 *  设置为网络 提示图
 *
 *  @param image 图片
 */
- (void)setimageNetwork:(UIImage *)image{
    
    self.imageNetwork.image = image;
}


//#pragma mark - MONActivityIndicatorViewDelegate Methods
//
//- (UIColor *)activityIndicatorView:(MONActivityIndicatorView *)activityIndicatorView
//      circleBackgroundColorAtIndex:(NSUInteger)index {
//    CGFloat red   = (arc4random() % 256)/255.0;
//    CGFloat green = (arc4random() % 256)/255.0;
//    CGFloat blue  = (arc4random() % 256)/255.0;
//    CGFloat alpha = 1.0f;
//    return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
//}

@end
